import 'package:flutter/material.dart';
import 'package:english_words/english_words.dart';

class ScrollPage extends StatefulWidget {
  @override
  State<StatefulWidget> createState() => ScrollPageState();
}

class ScrollPageState extends State<ScrollPage> {
  final _words = List<WordPair>();

  @override
  Widget build(BuildContext context) {
    _words.clear();
    _words.addAll(generateWordPairs().take(50));
    return Scaffold(
      appBar: AppBar(title: Text("SingleChildScrollView 组件")),
      body: Container(
        width: double.infinity,
        height: double.infinity,
        child: Scrollbar(
          child: SingleChildScrollView(
            padding: EdgeInsets.all(10),
            child: Column(
              children: _words
                  .map((word) => Container(
                        margin: EdgeInsets.all(10),
                        child: Text(
                          word.asString,
                          style: TextStyle(
                              fontSize: 16,
                              fontWeight: FontWeight.bold,
                              fontStyle: FontStyle.italic),
                        ),
                      ))
                  .toList(),
            ),
          ),
        ),
      ),
    );
  }
}
